<?php

/***************************************************************
**                Linux Vod@home Streaming Server             ** 
****************************************************************

   Written by Nicolas VOISIN Aka DaNifty

****************************************************************/

error_reporting(E_ALL);
ignore_user_abort(true);


include_once("./head.inc.php");

$file = "";
if (isset($_GET['file'])) $file = $_GET['file'];

$name = $file;

include_once("./stats.inc.php");


if (isset($_GET['thumb']))
{
        header("Content-type: image/png");
        readfile("greenband.png");
        exit (0);
}
else 
{

  if (isset($_GET['thumb']) && $return_value != 0)
  {
        echo file_get_contents("error.jpg");
  }

  if (!isset($_GET['thumb']) && $return_value != 0)
  {
        $fh = fopen("error.flv", "rb");
	while (!feof($fh))
        {
 	 	echo fread($fh, 2048);
 	 	ob_flush();flush();

	}
	fclose($fh);
  }
}

// -----------------------------------------------

function stop_on_abort($process, $read)
{
        if (connection_status() !== 0)
        {
                do
                {
                        $state = proc_get_status($process);
                        proc_terminate($process);
                        fclose($read);
                        proc_close($process);
                }
                while($state['running']);
                return true;
        }
        return false;
}
?>